package indi.zhifa.recipe.bailan.framework.auth.handler;

import indi.zhifa.recipe.bailan.framework.auth.property.UserConfig;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@AllArgsConstructor
public class PasswdEncoderFactory {
    final UserConfig userConfig;

    @Bean
    PasswordEncoder getPasswordEncoder(){
        return new BCryptPasswordEncoder(userConfig.getPasswd().getStrength());
    }
}
